<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>新闻评论</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/info.css">
<script language="javascript" type="text/javascript" src=""></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript"> 
	 
	
</script>
<style type="text/css">
 body,td,div{
   font-size:12px;
 }
.reply_add{
	margin-top:5px;
	margin-bottom:15px;
	width:100%;
	border-collapse: collapse;
}
.reply_add td{
	padding:5px;
	border:1px solid #d2d2d8;
}
.reply_add .theme{
	height:28px;
	background-image:url('images/wbg.gif');
	font-weight:bold;
}
</style>
</head>
<body>
<jsp:include page="top.jsp"></jsp:include>
<div id="middle">
	<div id="list">
		 <div class="nav">当前位置: 主页 > 新闻评论 </div>
		 <div class="list_info">
		 	<s:if test="totalCount > 0">
		 	<s:iterator value="#attr.comments" id="comment">
			<ul>
				<li>
					[<strong>新闻评论</strong>] <s:a href="page_getComment.action?paramsComment.comment_id=%{#comment.comment_id}" target="_blank" title="%{#comment.comment_title}">
						 <s:property value="#comment.comment_title.length()>26?#comment.comment_title.substring(0,26)+'...':#comment.comment_title"/>
					</s:a>　<span style="color:#666"><s:property value="#comment.comment_date.substring(0,19)"/> (<s:property value="#comment.comment_click"/>点击)</span>
				</li>
				<li class="li_hr">
					<hr />
				</li>
			</ul>
			</s:iterator>
	 		</s:if>
		 </div>
		 <jsp:include page="page.jsp"></jsp:include>
		 
		 <!-- 发布信息 -->
		 <div>
		 <form name="info" id="info" style="width:100%" action="page_addComment.action" method="post">
		 <input type="hidden" name="paramsComment.user_id" id="paramsComment.user_id" value="<s:property value='#attr.user.user_id' />"/>
		 <input type="hidden" name="paramsComment.comment_pics" id="paramsComment.comment_pics" />
		 <table class="reply_add">
				<tr>
					<td class="theme" colspan="4">发布信息：</td>
				</tr>
				<tr>
					<td align="right" width="18%">发布标题：</td>
					<td align="left" width="32%"><input value="${paramsComment.comment_title}" type="text" name="paramsComment.comment_title" id="paramsComment.comment_title" style="width:200px;" class="inputstyle"/></td>
					<td align="right" width="18%">验证码：</td>
					<td align="left">
						<input type="text" id="paramsComment.random" name="paramsComment.random" style="width:80px;" class="inputstyle"/>
						&nbsp;<img src="Random.jsp" width="50" valign="middle" style="cursor:pointer;vertical-align:middle" title="换一张" id="safecode" border="0" onClick="reloadcode()"/>
					</td>
				</tr>
				<tr>
					<td align="right" width="18%">发布内容：</td>
					<td align="left" width="32%"><textarea name="paramsComment.comment_content" id="paramsComment.comment_content" style="width:200px;height:50px" class="inputstyle">${paramsComment.comment_content}</textarea></td>
					<td align="right" width="18%">选择头像：</td>
					<td align="left">
						<input type="radio" name="paramsComment.comment_pic" checked="checked" value="images/head/man04.gif" />
						<img src="images/head/man04.gif" width="50" />
						<input type="radio" name="paramsComment.comment_pic" value="images/head/woman08.gif" />
						<img src="images/head/woman08.gif" width="50" />
					</td>
				</tr>
				<tr>
				  <td align="right" style="padding-right:5px">发布图片：</td>
				  <td align="left" style="height:80px">
				    <span id="pics" style="width:180px"></span>&nbsp;
			        <span id="op" style="display:none;width:100px"><img src="images/loading004.gif"  height="80" /></span>
			      </td>
			      <td align="left" colspan="2"> 
			          <iframe name="uploadPage" src="uploadImg.jsp" width="100%" height="80" marginheight="0" marginwidth="0" scrolling="no" frameborder="0"></iframe>            
			       </td>
			  </tr>
				<tr>
					<td align="center" colspan="4">
						<input type="button" id="addBtn" class="btnstyle" value="提交"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<input type="reset" id="resetBtn" class="btnstyle" value="清空"/>
					</td>
				</tr>
		 </table>
		 </form>
		 </div>
	</div>
	<%--<div id="Picture"></div>--%>
</div>
<jsp:include page="bottom.jsp"></jsp:include>
<script language="javascript" type="text/javascript">
	function GoPage()
	{
	  var pagenum=document.getElementById("goPage").value;
	  var patten=/^\d+$/;
	  if(!patten.exec(pagenum))
	  {
	    alert("页码必须为大于0的数字");
	    return false;
	  }
	  window.location.href="page_listComments.action?pageNo="+pagenum;
	}
	function ChangePage(pagenum)
	{
		window.location.href="page_listComments.action?pageNo="+pagenum;
	}
	
	var user_id = "<s:property value='#attr.user.user_id' />";
	var tip = "${tip}";
	if(tip!=''){
		alert(tip);
	}

	//实现验证码点击刷新
	function reloadcode(){
		var verify=document.getElementById('safecode');
		verify.setAttribute('src','Random.jsp?'+Math.random());
	}

	$(document).ready(function(){
		var title = $("#paramsComment\\.comment_title");
		var random = $("#random");
		var content = $("#paramsComment\\.comment_content");
		$("#addBtn").bind("click",function(){
			
			if(user_id==''){
				alert('请先登录后再进行发布信息！')
				return;
			}
			if(title.val()==''){
				alert('发布标题不能为空！')
				return;
			}
			if(random.val()==''){
				alert('验证码不能为空！')
				return;
			}
			if(content.val()==''){
				alert('发布内容不能为空！')
				return;
			}
			$("#info").submit();
		});
	});
</script>
</body>
</html>